package org.yu.team2023.flashdays.registries;

import net.minecraft.data.PackOutput;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.packs.PackType;
import net.minecraft.world.level.ItemLike;
import net.minecraftforge.client.model.generators.ItemModelProvider;
import net.minecraftforge.client.model.generators.ModelProvider;
import net.minecraftforge.common.data.ExistingFileHelper;

import java.util.List;
import java.util.Map;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Supplier;

public class SimpleItemModelProvider extends ItemModelProvider {
    protected final Map<Supplier<? extends ItemLike>, BiConsumer<Supplier<? extends ItemLike>,SimpleItemModelProvider>> map;
    public SimpleItemModelProvider(PackOutput output, String modid, ExistingFileHelper existingFileHelper,Map<Supplier<? extends ItemLike>, BiConsumer<Supplier<? extends ItemLike>,SimpleItemModelProvider>> map) {
        super(output, modid, existingFileHelper);
        this.map = map;
    }

    @Override
    protected void registerModels() {
       map.forEach((i,c)->c.accept(i,this));
    }
    public boolean checkTexture(ResourceLocation id){
        assert existingFileHelper != null;
        return existingFileHelper.exists(id, ModelProvider.TEXTURE);
    }
}
